package com.ecs.to_tos_service.controller;

/**
 * Created by wawayang on 2019/4/24.
 */

import com.ecs.to_tos_service.domain.GmsTrucknoInfo;
import com.ecs.to_tos_service.service.OracleTestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping("/api/v1/oracle")
public class OracleTestController {

    @Autowired
    private OracleTestService oracleTestService;

    @Value("${server.port}")
    private String port;

//    @RequestMapping("list")
//    public Object list(){
//        return productService.listProduct();
//    }
//
//    @RequestMapping("find")
//    public Object findByid(@RequestParam("id") int id) throws InterruptedException {
//        if (1== id)
//        {
//
////            Thread.sleep(100000);
//            TimeUnit.SECONDS.sleep(2);
//        }
//        Product product = productService.findById(id);
//        Product result = new Product();
//        BeanUtils.copyProperties(product,result);
//
//        result.setName( result.getName() + "data from port = " + port);
//
//        return result ;
//    }

    @RequestMapping("gmsInfo")
    public Object findGmsInfoById(@RequestParam("id") String id) throws InterruptedException {

        List<GmsTrucknoInfo> product = oracleTestService.getListById(id);

        return product ;
    }

    @RequestMapping("gmsTruckNo")
    public Object findGmsInfoByTruck(@RequestParam("id") String truck) throws InterruptedException {

        List<GmsTrucknoInfo> product = oracleTestService.getListByTruckNo(truck);

        return product ;
    }
}
